package com.aaa.vegetablemarketexpress.dao;

import com.aaa.vegetablemarketexpress.entity.ShopProduct;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @FileName: ShopProductDao
 * @Description:
 * @Author: 张钰哲
 * @CreateTime: 2025/9/12 14:16
 * @Version: 1.0.0
 */

public interface ShopProductDao {
    /**
     * 根据ID查询关联
     * @param id
     * @return
     */
    ShopProduct selectShopProductById(Long id);

    /**
     * 查询店铺商品关联列表
     * @param shopProduct
     * @return
     */
    List<ShopProduct> selectShopProductList(ShopProduct shopProduct);

    /**
     * 根据店铺ID查询关联的商品ID列表
     * @param shopId
     * @return
     */
    List<Long> selectProductIdsByShopId(Long shopId);

    /**
     * 根据商品ID查询关联的店铺ID列表
     * @param productId
     * @return
     */
    List<Long> selectShopIdsByProductId(Long productId);

    /**
     * 新增店铺商品关联
     * @param shopProduct
     * @return
     */
    int insertShopProduct(ShopProduct shopProduct);

    /**
     * 批量新增店铺商品关联
     * @param shopProductList
     * @return
     */
    int batchInsertShopProduct(List<ShopProduct> shopProductList);

    /**
     * 删除店铺商品关联
     * @param id
     * @return
     */
    int deleteShopProductById(Long id);

    /**
     * 根据店铺ID和商品ID删除关联
     * @param shopId
     * @param productId
     * @return
     */
    int deleteShopProduct(@Param("shopId") Long shopId, @Param("productId") Long productId);

    /**
     * 根据店铺ID删除所有关联
     * @param shopId
     * @return
     */
    int deleteShopProductByShopId(Long shopId);

    /**
     * 根据商品ID删除所有关联
     * @param productId
     * @return
     */
    int deleteShopProductByProductId(Long productId);

    /**
     * 检查关联是否存在
     * @param shopId
     * @param productId
     * @return
     */
    int checkShopProductExist(@Param("shopId") Long shopId, @Param("productId") Long productId);

    ShopProduct selectShopProduct(@Param("shopId") Long shopId, @Param("productId") Long productId);


}
